.class Lcom/baidu/ab;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic a:Lcom/baidu/AdView;

.field final synthetic b:Lcom/baidu/AdView;


# direct methods
.method constructor <init>(Lcom/baidu/AdView;Lcom/baidu/AdView;)V
    .locals 0

    iput-object p1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    iput-object p2, p0, Lcom/baidu/ab;->a:Lcom/baidu/AdView;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 7

    :try_start_0
    iget-object v0, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v0}, Lcom/baidu/AdView;->f(Lcom/baidu/AdView;)V

    iget-object v0, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v0}, Lcom/baidu/AdView;->g(Lcom/baidu/AdView;)V

    iget-object v0, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v0}, Lcom/baidu/AdView;->c(Lcom/baidu/AdView;)Lcom/baidu/t;

    move-result-object v0

    invoke-static {v0}, Lcom/baidu/o;->a(Lcom/baidu/t;)Lcom/baidu/o;

    move-result-object v0

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v1}, Lcom/baidu/AdView;->getContext()Landroid/content/Context;

    move-result-object v1

    iget-object v2, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v2}, Lcom/baidu/AdView;->h(Lcom/baidu/AdView;)Ljava/lang/String;

    move-result-object v2

    iget-object v3, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v3}, Lcom/baidu/AdView;->i(Lcom/baidu/AdView;)Lcom/baidu/s;

    move-result-object v3

    invoke-virtual {v0, v1, v2, v3}, Lcom/baidu/o;->a(Landroid/content/Context;Ljava/lang/String;Lcom/baidu/s;)Lcom/baidu/Ad;

    move-result-object v0

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v1}, Lcom/baidu/AdView;->a()Z

    move-result v1

    if-eqz v1, :cond_0

    const-string v0, "AdLoaderHandler.run"

    const-string v1, "[has spam] do nothing, wait next timeout"

    invoke-static {v0, v1}, Lcom/baidu/bk;->b(Ljava/lang/String;Ljava/lang/String;)I

    :goto_0
    iget-object v0, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/baidu/AdView;->a(Lcom/baidu/AdView;Z)V

    :goto_1
    return-void

    :cond_0
    if-nez v0, :cond_1

    const-string v0, "AdLoaderHandler.run"

    const-string v1, "No Ads in cache"

    invoke-static {v0, v1}, Lcom/baidu/bk;->b(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v1}, Lcom/baidu/AdView;->l(Lcom/baidu/AdView;)V

    const-string v1, "AdLoadHandler.run"

    const-string v2, "Unhandled exception while requesting an ad."

    invoke-static {v1, v2, v0}, Lcom/baidu/bk;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_1

    :cond_1
    :try_start_1
    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v1}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v1

    invoke-virtual {v1}, Lcom/baidu/l;->b()V

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    iget-object v2, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v2}, Lcom/baidu/AdView;->getWidth()I

    move-result v2

    iget-object v3, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v3}, Lcom/baidu/AdView;->getHeight()I

    move-result v3

    invoke-static {v1, v2, v3, v0}, Lcom/baidu/AdView;->a(Lcom/baidu/AdView;IILcom/baidu/Ad;)Lcom/baidu/ag;

    move-result-object v1

    const-string v2, "AdLoaderHandler.run"

    const-string v3, "adapter size(%d, %d)"

    const/4 v4, 0x2

    new-array v4, v4, [Ljava/lang/Object;

    const/4 v5, 0x0

    iget v6, v1, Lcom/baidu/ag;->a:I

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    aput-object v6, v4, v5

    const/4 v5, 0x1

    iget v6, v1, Lcom/baidu/ag;->b:I

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    aput-object v6, v4, v5

    invoke-static {v3, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Lcom/baidu/bk;->b(Ljava/lang/String;Ljava/lang/String;)I

    iget-object v2, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v2}, Lcom/baidu/AdView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v2

    iget v3, v1, Lcom/baidu/ag;->a:I

    iput v3, v2, Landroid/view/ViewGroup$LayoutParams;->width:I

    iget v3, v1, Lcom/baidu/ag;->b:I

    iput v3, v2, Landroid/view/ViewGroup$LayoutParams;->height:I

    iget-object v3, p0, Lcom/baidu/ab;->a:Lcom/baidu/AdView;

    invoke-virtual {v3, v2}, Lcom/baidu/AdView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    iget-object v2, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v2}, Lcom/baidu/AdView;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-static {v2}, Lcom/baidu/r;->i(Landroid/content/Context;)I

    move-result v2

    iget-object v3, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v3}, Lcom/baidu/AdView;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-static {v3}, Lcom/baidu/r;->h(Landroid/content/Context;)I

    move-result v3

    iget-object v4, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v4}, Lcom/baidu/AdView;->c(Lcom/baidu/AdView;)Lcom/baidu/t;

    move-result-object v4

    sget-object v5, Lcom/baidu/t;->b:Lcom/baidu/t;

    if-ne v4, v5, :cond_2

    invoke-static {v2, v3}, Ljava/lang/Math;->min(II)I

    move-result v2

    iput v2, v1, Lcom/baidu/ag;->a:I

    iget v2, v1, Lcom/baidu/ag;->a:I

    int-to-double v2, v2

    invoke-virtual {v0}, Lcom/baidu/Ad;->c()Landroid/graphics/Bitmap;

    move-result-object v4

    invoke-virtual {v4}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v4

    int-to-double v4, v4

    div-double/2addr v2, v4

    invoke-virtual {v0}, Lcom/baidu/Ad;->c()Landroid/graphics/Bitmap;

    move-result-object v4

    invoke-virtual {v4}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v4

    int-to-double v4, v4

    mul-double/2addr v2, v4

    double-to-int v2, v2

    iput v2, v1, Lcom/baidu/ag;->b:I

    :cond_2
    iget-object v2, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v2}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v2

    iget-object v3, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v3}, Lcom/baidu/AdView;->getVisibility()I

    move-result v3

    invoke-virtual {v2, v3}, Lcom/baidu/l;->setVisibility(I)V

    new-instance v2, Landroid/widget/RelativeLayout$LayoutParams;

    iget v3, v1, Lcom/baidu/ag;->a:I

    iget v4, v1, Lcom/baidu/ag;->b:I

    invoke-direct {v2, v3, v4}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    const/16 v3, 0xd

    invoke-virtual {v2, v3}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(I)V

    iget-object v3, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v3}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v3

    invoke-virtual {v3, v2}, Lcom/baidu/l;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    iget-object v2, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v2}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v2

    iget-object v3, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v3}, Lcom/baidu/AdView;->c(Lcom/baidu/AdView;)Lcom/baidu/t;

    move-result-object v3

    iget-object v4, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v4}, Lcom/baidu/AdView;->k(Lcom/baidu/AdView;)I

    move-result v4

    invoke-virtual {v2, v0, v3, v4, v1}, Lcom/baidu/l;->a(Lcom/baidu/Ad;Lcom/baidu/t;ILcom/baidu/ag;)V

    iget-object v0, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v0}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v0

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v1}, Lcom/baidu/AdView;->getBackgroundColor()I

    move-result v1

    invoke-virtual {v0, v1}, Lcom/baidu/l;->setBackgroundColor(I)V

    iget-object v0, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v0}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v0

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v1}, Lcom/baidu/AdView;->getBackgroundTransparent()I

    move-result v1

    invoke-virtual {v0, v1}, Lcom/baidu/l;->b(I)V

    iget-object v0, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v0}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v0

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-virtual {v1}, Lcom/baidu/AdView;->getTextColor()I

    move-result v1

    invoke-virtual {v0, v1}, Lcom/baidu/l;->a(I)V

    iget-object v0, p0, Lcom/baidu/ab;->a:Lcom/baidu/AdView;

    iget-object v1, p0, Lcom/baidu/ab;->b:Lcom/baidu/AdView;

    invoke-static {v1}, Lcom/baidu/AdView;->j(Lcom/baidu/AdView;)Lcom/baidu/l;

    move-result-object v1

    invoke-virtual {v1}, Lcom/baidu/l;->g()Landroid/view/animation/Animation;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/baidu/AdView;->startAnimation(Landroid/view/animation/Animation;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto/16 :goto_0
.end method
